/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Akanksha;
/**
 *
 * @author Akanksha Chauhan
 */
public class CheckStatus {
    
   public boolean startCheckStatus(){
      
        boolean clockFlag ;
        boolean batteryFlag;
        boolean Flag;
         // checks if the clock is working fine
        Clock time = new Clock();
        int currentTime = time.GetCurrentMinute();
        Timer checkClockStatus = new Timer();
        checkClockStatus.start();
        while(checkClockStatus.getElapsedTimeSecs()== 1)
        {
            //wait 
        }
       int newTime = Clock.GetCurrentSecond();
       if((newTime - currentTime) == 1000 )
            clockFlag = true;
        else
            clockFlag = false;
        
        // checks with the battery is working fine 
        Battery batteryStatus = new Battery();
        double batteryLevel = batteryStatus.getBatteryLevel();
        if(batteryLevel <= 15 )
          batteryFlag = true;
        else
          batteryFlag = false;
        
        if(clockFlag == true && batteryFlag== true )
            Flag = true;
        else
            Flag = false;
           return Flag;
    }
}
